//
//  TagManager.m
//  丁诚昊的外包项目(2016_V7宝)
//
//  Created by DimChum_Haul on 16/3/25.
//  Copyright © 2016年 沙罗双树831. All rights reserved.
//

#import "TagManager.h"
#import "PortalNaviContr.h"

#import "UIColor+ColorFullTemplate.h"
#import "UIView+Geometry.h"
#import "UIView+PhyMoVal.h"

@implementation TagManager
/** 
 * 注意：UITabBarButton在UITabBar中得位置是均分的，UITabBar的高度为49
 * UITabBarButton⾥面显⽰什么内容,由对应子控制器的tabBarItem属性来决定 
 */
+ (UITabBarController*) makeUPTabbarTag
{
    UITabBarController* tagViewBarContr = [[UITabBarController alloc]init];
    
    UIViewController* HomePage = [PortalNaviContr new];
    HomePage.tabBarItem.title = @"浏览商品";
    HomePage.tabBarItem.image = [[UIImage imageNamed:@"camera"]
                                 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    HomePage.tabBarItem.imageInsets = UIEdgeInsetsMake(2, 2, 2, 2);
    UIViewController* AroundMe = [UIViewController new];
    AroundMe.tabBarItem.title = @"周边信息";
    AroundMe.tabBarItem.image = [[UIImage imageNamed:@"package"]
                                 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    AroundMe.tabBarItem.imageInsets = UIEdgeInsetsMake(2, 2, 2, 2);
    AroundMe.view.backgroundColor = [UIColor redColor];
    
    UIViewController* ShopCar = [UIViewController new];
    ShopCar.tabBarItem.title = @"购物车";
    ShopCar.tabBarItem.image = [[UIImage imageNamed:@"video_camera"]
                                 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    ShopCar.tabBarItem.imageInsets = UIEdgeInsetsMake(2, 2, 2, 2);
    
    UIViewController* UserInfo = [UIViewController new];
    UserInfo.tabBarItem.title = @"个人中心";
    UserInfo.tabBarItem.image = [[UIImage imageNamed:@"gear_01"]
                                 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    UserInfo.tabBarItem.imageInsets = UIEdgeInsetsMake(2, 2, 2, 2);
    
    NSArray *ContrAry = @[HomePage,AroundMe,ShopCar,UserInfo];
    
    for (UIViewController* child in ContrAry) {
        [tagViewBarContr addChildViewController:child];
    }
    tagViewBarContr.selectedIndex = 0;
    
    UITabBarItem *appearance = [UITabBarItem appearance];
    [appearance setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor]}
                              forState:UIControlStateNormal];
    [appearance setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor GLColor]}
                              forState:UIControlStateSelected];
    [UIView simplifyWithCornerRadius:tagViewBarContr.view
                                with:10.0f];
    return tagViewBarContr;
}

@end
